//
//  WPMineScrollView.m
//  wobingwoyi
//
//  Created by WGP on 16/7/27.
//  Copyright © 2016年 WGP. All rights reserved.
//

#import "WPMineScrollView.h"
#import "WPHeaderView.h"
#import "WPMineThirdView.h"
#import "WPMineSecondView.h"

@interface WPMineScrollView ()

@end

@implementation WPMineScrollView

-(instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        
        [self setupUI];
    }
    return self;
}

-(void)setupUI
{
    self.backgroundColor = GlobalBgColor;
    
    self.headerView = [WPHeaderView headerViewWithHandleBlock:^(WPMineHeaderViewBtnType btnType) {
        if (btnType == WPMineHeaderViewBtnTypeLogin)
        {
            [self.WPMineDelegate WPMineHeaderViewViewLoginBtnDidClickWith:self];
            
        }else if (btnType == WPMineHeaderViewBtnTypeSetting)
        {
            [self.WPMineDelegate WPMineHeaderViewSettingBtnDidClickWith:self];
        }
    }];
    
    [self addSubview:self.headerView];
    
    self.secondView = [[WPMineSecondView alloc] init];
    
    [self addSubview:self.secondView];
    
    self.thirdView = [[WPMineThirdView alloc] init];
    
    [self addSubview:self.thirdView];
    
    [self.headerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(-20);
        make.width.mas_equalTo(SCREEN_WIDTH);
        make.height.mas_equalTo(SCREEN_WIDTH*200/375.0);
    }];
    
    [self.secondView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.headerView.mas_bottom).offset(10*SCALE);
        make.width.mas_equalTo(SCREEN_WIDTH);
        make.left.equalTo(self);
        make.height.mas_equalTo(153*SCALE);
    }];
    
    [self.thirdView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.secondView.mas_bottom).offset(10*SCALE);
        make.width.mas_equalTo(SCREEN_WIDTH);
        make.height.mas_equalTo(289*SCALE);
    }];
    
}



-(void)layoutSubviews
{
    [super layoutSubviews];
}

@end
